package bean;

import java.util.ArrayList;
import Dao.MDao;

public class Manage {
	private ArrayList<String> year = new ArrayList<>();
	private ArrayList<S_Course> course = new ArrayList<S_Course>();
	private ArrayList<Teacher> tea = new ArrayList<Teacher>();
	private ArrayList<S_Class> cla = new ArrayList<S_Class>();
	private ArrayList<Student> stu = new ArrayList<Student>();
	private int g_id ;
	private int cla_num ;
	
	public int getCla_num() {
		return cla_num;
	}
	public void setCla_num(int cla_num) {
		this.cla_num = cla_num;
	}
	public int getG_id() {
		return g_id;
	}
	public void setG_id(int g_id) {
		this.g_id = g_id;
	}
	public ArrayList<Student> getStu() {
		return stu;
	}
	public void setStu(ArrayList<Student> stu) {
		this.stu = stu;
	}
	public ArrayList<Teacher> getTea() {
		return tea;
	}
	public void setTea(ArrayList<Teacher> tea) {
		this.tea = tea;
	}
	public ArrayList<S_Class> getCla() {
		return cla;
	}
	public void setCla(ArrayList<S_Class> cla) {
		this.cla = cla;
	}
	
	public void setClass(String cla_name , String cla_id) {
		S_Class cla = new S_Class();
		cla.setCla_id(cla_id);
		cla.setCla_name(cla_name);
		this.cla.add(cla);
	}
	
	public void setStuAllCourse(String c_id , String c_name , String stu_name , double grade ,double gpa , double c_point) {
		S_Course cou = new S_Course();
		cou.setC_name(c_name);
		cou.setC_id(c_id);
		cou.setStu_name(stu_name);
		cou.setGrade(grade);
		cou.setC_point(c_point);
		cou.setGpa(gpa);
		this.course.add(cou);
	}

	public ArrayList<String> getYear() {
		return year;
	}
	public void setYear(ArrayList<String> year) {
		this.year = year;
	}
	public ArrayList<S_Course> getCourse() {
		return course;
	}
	public void setCourse(ArrayList<S_Course> course) {
		this.course = course;
	}
	public void setCourse(String c_id , String c_name) {

		S_Course cou = new S_Course();
		cou.setC_name(c_name);
		cou.setC_id(c_id);
		this.course.add(cou);
	}
	public void setOOT(String tea_name , String cla_name , String cla_id) {
		Teacher tea = new Teacher();
		S_Class cla = new S_Class();
		tea.setTea_name(tea_name);
		cla.setCla_name(cla_name);
		cla.setCla_id(cla_id);
		this.cla.add(cla);
		this.tea.add(tea);
		
	}
	
	public void setOOTG(Double grade, String cla_id) {
		Student stu = new Student();
		stu.setGrade(grade);
		stu.setClass(cla_id, null);
		this.stu.add(stu);
		
	}
	
	public Manage getBaseData() throws Exception {
		MDao m = new MDao();
		
		Manage man = new Manage();
		man = m.GetSco();
		return man;
	}
	
	public Manage ChangeOOTData(String c_id , String year) throws Exception {
		MDao m = new MDao();
		Manage man = new Manage();
		man = m.ChangeOOTData(c_id , year);
		return man;
	}
	
	public Manage getClaCouData() throws Exception {
		MDao m = new MDao();
		
		Manage man = new Manage();
		man = m.getClaCouData();
		return man;
	}
	public Manage getStuClaData() throws Exception {
		MDao m = new MDao();
		
		Manage man = new Manage();
		man = m.getStuClaData();
		return man;
	}
	
	public Manage ChangeClassCourseScore(String g_id , String year) throws Exception {
		MDao m = new MDao();
		
		Manage man = new Manage();
		man = m.ChangeClassCourseScore(g_id , year);
		return man;
	}
	
	public Manage getGForClass(String cla_id) throws Exception {
		MDao m = new MDao();
		
		Manage man = new Manage();
		man = m.getGForClass(cla_id);
		return man;
	}
	public Manage ClassStuChangeG(String cla_id , String g_id) throws Exception {
		MDao m = new MDao();
		
		Manage man = new Manage();
		man = m.ClassStuChangeG(cla_id , g_id);
		return man;
	}
	
	public String AddTeacher(String tea_name , String tea_sex, String tea_id) throws Exception {
		MDao m = new MDao();
		
		String man;
		man = m.AddTeacher(tea_name , tea_sex , tea_id);
		return man;
	}
	
	public String AddStudent(String stu_id , String stu_name, String stu_sex , String cla_id) throws Exception {
		MDao m = new MDao();
		
		String man;
		man = m.AddStudent(stu_id ,stu_name ,stu_sex , cla_id);
		return man;
	}
	
	public String AddCourse(String c_id , String c_name, String c_point , String c_time , String g_id) throws Exception {
		MDao m = new MDao();
		
		String man;
		man = m.AddCourse(c_id ,c_name ,c_point , c_time , g_id);
		return man;
	}
	
	public String AddClass(String cla_id , String cla_name) throws Exception {
		MDao m = new MDao();
		
		String man;
		man = m.AddClass(cla_id ,cla_name);
		return man;
	}
	public int Login(String id , String pwd) throws Exception {
		MDao m = new MDao();
		int man;
		man = m.Login(id ,pwd);
		return man;
	}
}
